"use strict";

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = (app) => {
  const { router, controller } = app;
  // router.get("/", controller.home.index);
  //重定向到swagger-ui.html
  app.router.redirect("/", "/swagger-ui.html", 302);

  router.get("/news", controller.news.list);

  router.get("/searchrouter/:name", controller.news.searchByrouter);
  router.get("/searchquery", controller.news.searchByquery);
  router.post("/searchbody", controller.news.searchBybody);
  router.post("/searchheader", controller.news.searchByheader);

  router.post("/upload", controller.upload.upload);

  /**
   * 用户模块
   */
  router.post("/user/create", controller.user.create);
};
